package com.raisecom.socket;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.Socket;
import java.net.UnknownHostException;

public class MyClientSocket {
	public static void main(String[] args) {
		try {
			Socket s = new Socket("127.0.0.1", 5555);
			OutputStream outputStream = s.getOutputStream();
			InputStream inputStream = s.getInputStream();
			BufferedReader bufr = new BufferedReader(new InputStreamReader(inputStream));
			
			String ss = "hahahaha\r\n";
			outputStream.write(ss.getBytes());
			outputStream.flush();
//			outputStream.close();
				
			String line = null;
			
			while ((line = bufr.readLine()) != null) {
				System.out.println(line);
			}
			
		} catch (UnknownHostException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
}
